package navigation

import (
	"context"
)

// Repository 导航仓储接口
type Repository interface {
	// Create 创建导航
	Create(ctx context.Context, navigation *Navigation) error

	// Update 更新导航
	Update(ctx context.Context, navigation *Navigation) error

	// Delete 删除导航
	Delete(ctx context.Context, id uint) error

	// GetByID 根据ID获取导航
	GetByID(ctx context.Context, id uint) (*Navigation, error)

	// GetByPosition 根据位置获取导航列表
	GetByPosition(ctx context.Context, position string) ([]*Navigation, error)

	// List 获取导航列表
	List(ctx context.Context, page, pageSize int) ([]*Navigation, int64, error)

	// CheckNameExists 检查导航名称是否存在
	CheckNameExists(ctx context.Context, name, position string, excludeID uint) (bool, error)

	// ExistsByName 检查名称是否存在
	ExistsByName(ctx context.Context, name, position string, excludeID uint) (bool, error)

	// ExistsByURL 检查URL是否存在
	ExistsByURL(ctx context.Context, url, position string, excludeID uint) (bool, error)

	// CheckParentExists 检查父导航是否存在
	CheckParentExists(ctx context.Context, parentID uint) (bool, error)

	// GetChildren 获取子导航
	GetChildren(ctx context.Context, parentID uint) ([]*Navigation, error)

	// GetTree 获取导航树
	GetTree(ctx context.Context, position string) ([]*NavigationNode, error)

	// BatchUpdateOrder 批量更新导航排序
	BatchUpdateOrder(ctx context.Context, items []OrderItem) error

	// UpdateStatus 更新导航状态
	UpdateStatus(ctx context.Context, id uint, status int) error
}
